Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtk3 #284

Merged
merged 61 commits into from
May 8, 2021
Merged

Gtk3 #284

merged 61 commits into from
May 8, 2021

Conversation

DarthGandalf
Copy link
Member

@DarthGandalf DarthGandalf commented Jun 14, 2020

The biggest blockers:

  • Gtk2::ImageView doesn't have analog in Gtk3. Working with author of Gtk2::ImageView who also made a partial port of it to Gtk3 to add missing features. It's used in 3 places:
    • showing the screenshot in the tab, zoomed
    • while selecting the rectangle of the area to take screenshot of
    • draw tool
    • Update: Gtk3::ImageView is now done and used here.
  • I can't figure out how to access subwindows, because ->XWINDOW is missing. The same function is needed for capturing context menus. It's ->get_xid now
  • I didn't yet try to fix the drawing. There is GooCanvas2, but I don't yet know how compatible it is with Goo::Canvas
  • Blurry preview window during Selection, blocked on upstream bug of goocanvas2 added a workaround

Other things are not done yet, but are doable with a bit of effort:

  • libunique needs porting to GtkApplication and Gio SimpleAction; I have a hello world app working
  • drag'n'drop shows some error in type, probably needs some massaging of GObject Introspection.
  • and a couple of other issues mentioned in TODO-GTK3.md

In the current state it can take screenshot of the whole desktop, of a single window, can upload, and even fixes an encoding bug of the current release (desktop name was garbled).

@Photon89
Copy link
Member

Regarding Gtk2::ImageView, this guy seems to have had the same problem and describes how he worked around it: https://martin.hoppenheit.info/blog/2014/image-scaling-with-gtk3-and-perl/ Looks like it is applicable at least for the preview in the screenshot tab.

@Photon89
Copy link
Member

Photon89 commented Jun 16, 2020

I created an issue, which outdated libs are blocking Shutter from entering the repos (for Arch Linux so far), to get some overview: #285

@Photon89
Copy link
Member

I thought I'd try to play around with the GooCanvas thingy and tried to run the latest commit from the gtk3 branch, but get

Can't locate object method "window" via package "Gtk3::MessageDialog" at bin/shutter line 7957.

Is this expected or is something messed up on my machine? I'm using this as Gtk3: https://www.archlinux.org/packages/community/any/perl-gtk3/

When removing the !$plugin_dialog->window check, it shows a tray icon but not the main window and the tray icon is dysfunctional.

@DarthGandalf
Copy link
Member Author

That's one of differences between perl-gtk2 and perl-gtk3. I kept changing it to get_window where I encountered this. But that codepath was never executed for me, because plugins were cached in settings xml already (by the gtk2 version), because I run one or another to understand what a particular button should do, if it didn't work in gtk3.

Fixed.

@Photon89
Copy link
Member

Launches and looks great, thanks! :)

@vadi2
Copy link
Contributor

vadi2 commented Jun 20, 2020

How would I test this? Checkout and then run what?

@Photon89
Copy link
Member

Just run bin/shutter from the main folder of the checked out repo.

@DarthGandalf
Copy link
Member Author

New release doesn't need to wait for this branch, btw.

@Photon89
Copy link
Member

Ok, then I will prepare the release asap!

As found by trial and error, this is required for "unique app"
functionality and message passing (aka action activation in gtk3
terminology)
At some point we need to reuse it instead of vendoring it
@DarthGandalf
Copy link
Member Author

Gscan2pdf had the same problem when migrating to Gtk3, therefore Gscan2pdf::ImageView mostly fits here, and is mostly compatible with our code.

@vadi2
Copy link
Contributor

vadi2 commented Feb 18, 2021

Force pushing makes it hard to review - could we do without it?

@DarthGandalf
Copy link
Member Author

DarthGandalf commented Feb 18, 2021 via email

@vadi2
Copy link
Contributor

vadi2 commented Mar 13, 2021

It looks like we're pretty dependant on a project that is not actively maintained, this is a problem. :(

@DarthGandalf
Copy link
Member Author

DarthGandalf commented Mar 13, 2021 via email

@DarthGandalf
Copy link
Member Author

DarthGandalf commented Mar 13, 2021 via email

@DarthGandalf
Copy link
Member Author

Alright, I did what I could here. The most broken things remaining:

  • support for multiple displays: I don't know whether it works - I might have broken it, if it ever worked, but I cannot test
  • on hidpi screens (with e.g. GDK_DPI_SCALE=0.5 GDK_SCALE=2 in environment) subwindow capture and menu capture take wrong part of the screen; I must have used wrong formula somewhere, but I don't know how to fix this

I'll need some help with those. And I don't know whether these issues are important enough to delay the release vs not having shutter in repos at all...

Also a few minor things:

  • draw tool: I just removed the rulers on top and left of the image because I couldn't find any replacement for them
  • cursor in the selector behaves slightly differently near the edges of the selection. Probably could be fixed, but it's not that big deal
  • in one of my tests the execution via ssh -X didn't work well, I don't know whether it's still a problem, or how to fix it

@DarthGandalf DarthGandalf marked this pull request as ready for review May 7, 2021 22:50
@DarthGandalf DarthGandalf mentioned this pull request May 8, 2021
@DarthGandalf DarthGandalf changed the title WIP: Gtk3 Gtk3 May 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants